home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / tr_types.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  6.0 KB  |  200 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3. #ifndef __TR_TYPES_H
  4. #define __TR_TYPES_H
  5.  
  6.  
  7. #define    MAX_DLIGHTS        32            // can't be increased, because bit flags are used on surfaces
  8. #define    MAX_ENTITIES    1023        // can't be increased without changing drawsurf bit packing
  9.  
  10. // renderfx flags
  11. #define    RF_MINLIGHT            1        // allways have some light (viewmodel, some items)
  12. #define    RF_THIRD_PERSON        2        // don't draw through eyes, only mirrors (player bodies, chat sprites)
  13. #define    RF_FIRST_PERSON        4        // only draw through eyes (view weapon, damage blood blob)
  14. #define    RF_DEPTHHACK        8        // for view weapon Z crunching
  15. #define    RF_NOSHADOW            64        // don't add stencil shadows
  16.  
  17. #define RF_LIGHTING_ORIGIN    128        // use refEntity->lightingOrigin instead of refEntity->origin
  18.                                     // for lighting.  This allows entities to sink into the floor
  19.                                     // with their origin going solid, and allows all parts of a
  20.                                     // player to get the same lighting
  21. #define    RF_SHADOW_PLANE        256        // use refEntity->shadowPlane
  22. #define    RF_WRAP_FRAMES        512        // mod the model frames by the maxframes to allow continuous
  23.                                     // animation without needing to know the frame count
  24.  
  25. // refdef flags
  26. #define RDF_NOWORLDMODEL    1        // used for player configuration screen
  27. #define RDF_HYPERSPACE        4        // teleportation effect
  28.  
  29. typedef struct {
  30.     vec3_t        xyz;
  31.     float        st[2];
  32.     byte        modulate[4];
  33. } polyVert_t;
  34.  
  35. typedef struct poly_s {
  36.     qhandle_t            hShader;
  37.     int                    numVerts;
  38.     polyVert_t            *verts;
  39. } poly_t;
  40.  
  41. typedef enum {
  42.     RT_MODEL,
  43.     RT_POLY,
  44.     RT_SPRITE,
  45.     RT_BEAM,
  46.     RT_RAIL_CORE,
  47.     RT_RAIL_RINGS,
  48.     RT_LIGHTNING,
  49.     RT_PORTALSURFACE,        // doesn't draw anything, just info for portals
  50.  
  51.     RT_MAX_REF_ENTITY_TYPE
  52. } refEntityType_t;
  53.  
  54. typedef struct {
  55.     refEntityType_t    reType;
  56.     int            renderfx;
  57.  
  58.     qhandle_t    hModel;                // opaque type outside refresh
  59.  
  60.     // most recent data
  61.     vec3_t        lightingOrigin;        // so multi-part models can be lit identically (RF_LIGHTING_ORIGIN)
  62.     float        shadowPlane;        // projection shadows go here, stencils go slightly lower
  63.  
  64.     vec3_t        axis[3];            // rotation vectors
  65.     qboolean    nonNormalizedAxes;    // axis are not normalized, i.e. they have scale
  66.     float        origin[3];            // also used as MODEL_BEAM's "from"
  67.     int            frame;                // also used as MODEL_BEAM's diameter
  68.  
  69.     // previous data for frame interpolation
  70.     float        oldorigin[3];        // also used as MODEL_BEAM's "to"
  71.     int            oldframe;
  72.     float        backlerp;            // 0.0 = current, 1.0 = old
  73.  
  74.     // texturing
  75.     int            skinNum;            // inline skin index
  76.     qhandle_t    customSkin;            // NULL for default skin
  77.     qhandle_t    customShader;        // use one image for the entire thing
  78.  
  79.     // misc
  80.     byte        shaderRGBA[4];        // colors used by rgbgen entity shaders
  81.     float        shaderTexCoord[2];    // texture coordinates used by tcMod entity modifiers
  82.     float        shaderTime;            // subtracted from refdef time to control effect start times
  83.  
  84.     // extra sprite information
  85.     float        radius;
  86.     float        rotation;
  87. } refEntity_t;
  88.  
  89.  
  90. #define    MAX_RENDER_STRINGS            8
  91. #define    MAX_RENDER_STRING_LENGTH    32
  92.  
  93. typedef struct {
  94.     int            x, y, width, height;
  95.     float        fov_x, fov_y;
  96.     vec3_t        vieworg;
  97.     vec3_t        viewaxis[3];        // transformation matrix
  98.  
  99.     // time in milliseconds for shader effects and other time dependent rendering issues
  100.     int            time;
  101.  
  102.     int            rdflags;            // RDF_NOWORLDMODEL, etc
  103.  
  104.     // 1 bits will prevent the associated area from rendering at all
  105.     byte        areamask[MAX_MAP_AREA_BYTES];
  106.  
  107.     // text messages for deform text shaders
  108.     char        text[MAX_RENDER_STRINGS][MAX_RENDER_STRING_LENGTH];
  109. } refdef_t;
  110.  
  111.  
  112. typedef enum {
  113.     STEREO_CENTER,
  114.     STEREO_LEFT,
  115.     STEREO_RIGHT
  116. } stereoFrame_t;
  117.  
  118.  
  119. /*
  120. ** glconfig_t
  121. **
  122. ** Contains variables specific to the OpenGL configuration
  123. ** being run right now.  These are constant once the OpenGL
  124. ** subsystem is initialized.
  125. */
  126. typedef enum {
  127.     TC_NONE,
  128.     TC_S3TC
  129. } textureCompression_t;
  130.  
  131. typedef enum {
  132.     GLDRV_ICD,                    // driver is integrated with window system
  133.                                 // WARNING: there are tests that check for
  134.                                 // > GLDRV_ICD for minidriverness, so this
  135.                                 // should always be the lowest value in this
  136.                                 // enum set
  137.     GLDRV_STANDALONE,            // driver is a non-3Dfx standalone driver
  138.     GLDRV_VOODOO                // driver is a 3Dfx standalone driver
  139. } glDriverType_t;
  140.  
  141. typedef enum {
  142.     GLHW_GENERIC,            // where everthing works the way it should
  143.     GLHW_3DFX_2D3D,            // Voodoo Banshee or Voodoo3, relevant since if this is
  144.                             // the hardware type then there can NOT exist a secondary
  145.                             // display adapter
  146.     GLHW_RIVA128,            // where you can't interpolate alpha
  147.     GLHW_RAGEPRO,            // where you can't modulate alpha on alpha textures
  148.     GLHW_PERMEDIA2            // where you don't have src*dst
  149. } glHardwareType_t;
  150.  
  151. typedef struct {
  152.     char                    renderer_string[MAX_STRING_CHARS];
  153.     char                    vendor_string[MAX_STRING_CHARS];
  154.     char                    version_string[MAX_STRING_CHARS];
  155.     char                    extensions_string[MAX_STRING_CHARS];
  156.  
  157.     int                        maxTextureSize;            // queried from GL
  158.     int                        maxActiveTextures;        // multitexture ability
  159.  
  160.     int                        colorBits, depthBits, stencilBits;
  161.  
  162.     glDriverType_t            driverType;
  163.     glHardwareType_t        hardwareType;
  164.  
  165.     qboolean                deviceSupportsGamma;
  166.     textureCompression_t    textureCompression;
  167.     qboolean                textureEnvAddAvailable;
  168.  
  169.     int                        vidWidth, vidHeight;
  170.     // aspect is the screen's physical width / height, which may be different
  171.     // than scrWidth / scrHeight if the pixels are non-square
  172.     // normal screens should be 4/3, but wide aspect monitors may be 16/9
  173.     float                    windowAspect;
  174.  
  175.     int                        displayFrequency;
  176.  
  177.     // synonymous with "does rendering consume the entire screen?", therefore
  178.     // a Voodoo or Voodoo2 will have this set to TRUE, as will a Win32 ICD that
  179.     // used CDS.
  180.     qboolean                isFullscreen;
  181.     qboolean                stereoEnabled;
  182.     qboolean                smpActive;        // dual processor
  183. } glconfig_t;
  184.  
  185.  
  186. #if !defined _WIN32
  187.  
  188. #define _3DFX_DRIVER_NAME    "libMesaVoodooGL.so"
  189. #define OPENGL_DRIVER_NAME    "libGL.so"
  190.  
  191. #else
  192.  
  193. #define _3DFX_DRIVER_NAME    "3dfxvgl"
  194. #define OPENGL_DRIVER_NAME    "opengl32"
  195.  
  196. #endif    // !defined _WIN32
  197.  
  198.  
  199. #endif    // __TR_TYPES_H
  200.